<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/js/jq/jquery.js"></script>
</head>
<body>

    <!-- 

        jquery的表单序列化(将对应表单的有效元素数据自动转换为key=value&key=value...)
        $(form).serialize():以查询字符串格式进行拼接表单中的数据，表单数据必须具有name属性，不支持文件上传


     -->
    <form id="data">
        <input type="text" name="username"> 
        <br><br>
        <textarea cols="30" rows="10" name="info"></textarea> 
        <br><br>
        <input type="radio" name="sex" value="男">男
        <input type="radio" name="sex" value="女">女
        <input type="radio" name="sex" value="未知">未知
        <br><br>
        <input type="checkbox" name="skill" value="html">html
        <input type="checkbox" name="skill" value="css">css
        <input type="checkbox" name="skill" value="JS">JS
        <input type="checkbox" name="skill" value="echarts">echarts
        <br><br>
        <select name="a">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
        </select>
        <br><br>
       
    </form>
    <input type="button" value="发送请求" onclick="sendAjax()"> 
    <script>
        function sendAjax(){
            // console.log($("#data").serialize());//查询字符串的格式
            $.ajax({
                url:"/jquery/test",
                data:$("#data").serialize(),
                success:function(data){
                    console.log(data);
                }
            });
        }
    </script>

</body>
</html>